/*
 * @Description: 保证金管理DS
 * @Version: 1.0
 * @Autor: c-jack.qian
 * @Date: 2020-12-28 20:03:25
 * @LastEditors: c-jack.qian
 * @LastEditTime: 2021-04-25 14:50:01
 */
import { FieldType } from 'choerodon-ui/pro/lib/data-set/enum';
import commonConfigStore from '@common/config/commonConfig';
import intl from 'utils/intl';
const O2_OM = process.env.NODE_ENV === 'development' ? '/o2om-c' : commonConfigStore.O2_OM;

const marginManagementDS = () => ({
    autoQuery: true,
    selection: 'multiple',
    primaryKey: 'id',
    transport: {
        read: config => {
            return {
                ...config,
                url: `${O2_OM}/v1/product-deposits`,
                method: 'get',
            };
        },
        destroy: config => {
            return {
                ...config,
                url: `${O2_OM}/v1/product-deposits`,
                method: 'delete',
            };
        },
    },
    fields: [
        {
            name: 'businessGroupMeaning',
            type: FieldType.string,
            label: intl.get('dji.otc.om.view.field.groupName').d('组别'),
        },
        {
            name: 'regionName',
            type: FieldType.string,
            label: intl.get('dji.otc.om.view.field.region').d('大区'),
            required: true,
        },
        {
            name: 'areaName',
            type: FieldType.string,
            label: intl.get('dji.otc.om.view.field.area').d('小区'),
            required: true,
        },
        {
            name: 'productCode',
            type: FieldType.string,
            label: intl.get('dji.otc.om.view.field.productionCode').d('产品编码'),
        },
        {
            name: 'productName',
            type: FieldType.string,
            label: intl.get('dji.otc.om.view.field.productName').d('产品名称'),
        },
        {
            name: 'depositPrice',
            type: FieldType.number,
            label: intl.get('dji.otc.om.view.field.depositPrice').d('保证金单价'),
        },
    ],
    queryFields: [
        {
            label: intl.get('dji.otc.om.view.field.groupName').d('组别'),
            name: 'businessGroupCode',
            type: FieldType.string,
            lookupCode: 'DJICM_GROUP',
        },
        {
            label: intl.get('dji.otc.om.view.field.area').d('小区'),
            name: 'areaId',
            type: FieldType.string,
            lookupCode: 'DJIOM_CHOOSE_SMALL_AREA',
        },
        {
            name: 'productName',
            type: FieldType.string,
            label: intl.get('dji.otc.om.view.field.productName').d('产品'),
        },
    ],
});


export { marginManagementDS };
